using System.Collections.Generic;

namespace wMobinium.core.test
{
    [NUnit.Framework.TestFixture]
    public class TestPackageBuilderTest
    {
        private string mockAssembly = @"..\..\..\MockAssembly\outlookContacts.Tests\bin\Debug\OutlookContacts.Tests.dll";
        private TestPackageBuilder testPackageBuilder = new TestPackageBuilder();
        private TestPackage expectedTestPackage = new TestPackage();
        private TestPackage returnedTestPackage = new TestPackage();
        private string testSuiteName = "Mock Assembly Test";

        [NUnit.Framework.Test]
        public void EnsureSuiteBuilderReturnsCorrectTestSuite()
        {
            List<AssemblyDetail> assemblyDetails = new List<AssemblyDetail>();
            assemblyDetails.Add(
                new AssemblyDetail(mockAssembly, "", @"..\..\..\MockAssembly\outlookContacts.Tests\bin\Debug\"));

            returnedTestPackage = testPackageBuilder.Build(testSuiteName, assemblyDetails);
            expectedTestPackage = CreateExpectedTestSuite();

            NUnit.Framework.Assert.AreEqual(expectedTestPackage, returnedTestPackage);
        }

        private TestPackage CreateExpectedTestSuite()
        {
            TestPackageTest testPackageTest = new TestPackageTest();

            TestPackageClass testClass1 =
                testPackageTest.CreateTestClass("NameTest", "ensureNameIsEqual", "ensureNullNameIsNotEqualToName");
            TestPackageClass testClass2 =
                testPackageTest.CreateTestClass("OutlookContactTest", "ensureContactIsEqual",
                                                "ensureNullContactIsNotEqualToContact");
//            testClass2.TestMethods.Add(testPackageTest.CreateTestMethod("Setup"));
//            testClass2.TestMethods.Add(testPackageTest.CreateTestMethod("Cleanup"));
//            testClass2.TestMethods.Add(testPackageTest.CreateTestMethod("FixtureSetUp"));
//            testClass2.TestMethods.Add(testPackageTest.CreateTestMethod("FixtureCleanup"));

            TestPackageAssembly testPackageAssembly =
                testPackageTest.CreateTestAssembly("OutlookContacts.Tests", "OutlookContacts.Tests.dll", testClass1,
                                                   testClass2);

            TestPackage testPackage = new TestPackage();
            testPackage.Name = testSuiteName;
            testPackage.TestAssemblies.Add(testPackageAssembly);

            return testPackage;
        }
    }
}